<html>
<head><meta charset="utf-8"><title>Write text output files to stdout if opti… compiler-team#431 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html">Write text output files to stdout if opti… compiler-team#431</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="238660056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238660056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238660056">(May 13 2021 at 18:24)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/compiler-team/issues/431">Write text output files to stdout if options like <code>-o -</code> or <code>--emit asm=-</code> are provided #431</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="238660411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238660411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238660411">(May 13 2021 at 18:27)</a>:</h4>
<p>I'd be interested in more detail on what is meant by "text" here and whether it makes sense - I'd expect that we'd always go to stdout for the primary artifact with -, not try to differentiate between different kinds of output too much. OTOH, people probably don't want a binary spit out to stdout if it's a tty, so maybe we can look at curl's detection for example...</p>



<a name="238661309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238661309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pjhades <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238661309">(May 13 2021 at 18:34)</a>:</h4>
<p>Probably I didn't pick the precise name. By text I mean MIR, LLVM IR, assembly and dependency info. Yeah I agree that it makes little sense to write binary to a terminal.</p>



<a name="238661886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238661886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238661886">(May 13 2021 at 18:38)</a>:</h4>
<p>if a binary would go to a terminal, do you make that an error? or fall back to a file named <code>-</code> again?</p>



<a name="238661930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238661930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238661930">(May 13 2021 at 18:38)</a>:</h4>
<p>I'd lean toward an error</p>



<a name="238663174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238663174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238663174">(May 13 2021 at 18:49)</a>:</h4>
<p>I lean similarly</p>



<a name="238665729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238665729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pjhades <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238665729">(May 13 2021 at 19:08)</a>:</h4>
<p>What do you think of leaving binary output as is? I mean, making <code>-</code> work only with <code>mir</code>, <code>llvm-ir</code>, <code>asm</code> and <code>dep-info</code>. Binary outputs still go to files. (possibly a file named <code>-</code>).</p>



<a name="238665757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238665757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pjhades <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238665757">(May 13 2021 at 19:08)</a>:</h4>
<p>I made some local changes (not pushed yet) but currently I'm having issues regarding binary outputs not written to file. I guess I missed something.</p>



<a name="238665910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238665910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238665910">(May 13 2021 at 19:09)</a>:</h4>
<p>I don't like the inconsistency -- like it would be confusing if you could pipe <code>llvm-ir</code> to <code>opt</code>/<code>llc</code>, but not <code>llvm-bc</code></p>



<a name="238666863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/238666863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#238666863">(May 13 2021 at 19:17)</a>:</h4>
<p>I would want to have binary output to to stdout as well, yeah. We can do a simple check to see if stdout is a terminal, and if it is, print an error and stop rather than outputting it, unless we get an additional command line argument forcing binary output to something that looks like a terminal.</p>



<a name="241395113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241395113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241395113">(Jun 03 2021 at 14:06)</a>:</h4>
<p>I suppose this is an orthgonal point, but someone was recently asking me whether there was a way to get the compiler to accept input via stdin</p>



<a name="241395143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241395143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241395143">(Jun 03 2021 at 14:06)</a>:</h4>
<p>(it seems like it might be nice to solve both problems at the same time, if we can.)</p>



<a name="241395241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241395241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241395241">(Jun 03 2021 at 14:07)</a>:</h4>
<p>((I know ways to do it on Linux that leverage special file system paths. I think the idea was to provide a more cross-platform solution.))</p>



<a name="241395414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241395414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241395414">(Jun 03 2021 at 14:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431/near/241395113">said</a>:</p>
<blockquote>
<p>I suppose this is an orthgonal point, but someone was recently asking me whether there was a way to get the compiler to accept input via stdin</p>
</blockquote>
<p>It is already possible with <code>-</code>.</p>



<a name="241418984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241418984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241418984">(Jun 03 2021 at 16:52)</a>:</h4>
<p>Oh, does that work on all platforms?</p>



<a name="241419573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Write%20text%20output%20files%20to%20stdout%20if%20opti%E2%80%A6%20compiler-team%23431/near/241419573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Write.20text.20output.20files.20to.20stdout.20if.20opti.E2.80.A6.20compiler-team.23431.html#241419573">(Jun 03 2021 at 16:56)</a>:</h4>
<p>Seems to, yeah.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>